package com.aischool.webapp.family;

import com.aischool.params.AiLifePiceseParams;
import com.aischool.routes.RouteMapping;
import com.aischool.service.AiLifePiceseService;
import com.aischool.utils.AppUtil;
import com.aischool.utils.JsonCodeEnum;
import com.aischool.utils.JsonResult;
import com.jfinal.aop.Inject;

@RouteMapping(url = "/front/family/classes")
public class ClassesController extends BaseFamilyController {

	@Inject
	AiLifePiceseService aiLifePiceseService;
	
	/**
	 * 首页：班级
	 */
	public void index() {
		render(view_path + "/classes.html");
	}
	
	public void getLifePicese() {
		// 结果类
		JsonResult jr = new JsonResult();
		// 参数类
		AiLifePiceseParams params = new AiLifePiceseParams();
		
		// 获取参数
		int login_org_id = this.getAttrForInt("login_org_id");	
		int login_class_id = this.getAttrForInt("login_class_id");		
		//int type_id = getParaToInt("typeid",0);
		
		params.setPageNo(getParaToInt("pageNo", 1));
		params.setPageSize(getParaToInt("pageSize", AppUtil.Default_PageSize));
		
		//params.setTypeId(type_id); 
		params.setUserId(login_org_id);
		params.setClassId(login_class_id);
		params.setReadPower(1); // 1 公开
		
		params.setState(1);

		// 获取分页
		Object pageData = aiLifePiceseService.getPage(params);
		
		jr.setDicKV("pageData", pageData);
		
		
		jr.setEnum(JsonCodeEnum.Success);
		renderJson(jr.Dic);
	}
}
